﻿using System;
using System.ComponentModel;
using System.Runtime.InteropServices;

namespace Teigha.Core
{
	public class OdGeKnotVector : IDisposable
	{
		[EditorBrowsable(EditorBrowsableState.Never)]
		public OdGeKnotVector(IntPtr cPtr, bool cMemoryOwn)
		{
			this.swigCMemOwn = cMemoryOwn;
			this.swigCPtr = new HandleRef(this, cPtr);
		}

		[EditorBrowsable(EditorBrowsableState.Never)]
		public static HandleRef getCPtr(OdGeKnotVector obj)
		{
			if (obj != null)
			{
				return obj.swigCPtr;
			}
			return new HandleRef(null, IntPtr.Zero);
		}

		~OdGeKnotVector()
		{
			this.Dispose();
		}

		public virtual void Dispose()
		{
			if (this.swigCPtr.Handle != IntPtr.Zero)
			{
				if (this.swigCMemOwn)
				{
					lock (this.locker)
					{
						if (this.swigCPtr.Handle != IntPtr.Zero && this.swigCMemOwn)
						{
							this.swigCMemOwn = false;
							GlobalsPINVOKE.delete_OdGeKnotVector(this.swigCPtr);
						}
					}
					this.swigCMemOwn = false;
				}
				this.swigCPtr = new HandleRef(null, IntPtr.Zero);
			}
			GC.SuppressFinalize(this);
		}

		public double this[int i]
		{
			get
			{
				return this.GetItem(i);
			}
		}

		public OdGeKnotVector(double tol) : this(GlobalsPINVOKE.new_OdGeKnotVector__SWIG_0(tol), true)
		{
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public OdGeKnotVector() : this(GlobalsPINVOKE.new_OdGeKnotVector__SWIG_1(), true)
		{
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public OdGeKnotVector(int size, int growSize, double tol) : this(GlobalsPINVOKE.new_OdGeKnotVector__SWIG_2(size, growSize, tol), true)
		{
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public OdGeKnotVector(int size, int growSize) : this(GlobalsPINVOKE.new_OdGeKnotVector__SWIG_3(size, growSize), true)
		{
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public OdGeKnotVector(int size, double[] source, double tol) : this(GlobalsPINVOKE.new_OdGeKnotVector__SWIG_4(size, Helpers.MarshaldoubleFixedArray(source), tol), true)
		{
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public OdGeKnotVector(int size, double[] source) : this(GlobalsPINVOKE.new_OdGeKnotVector__SWIG_5(size, Helpers.MarshaldoubleFixedArray(source)), true)
		{
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public OdGeKnotVector(int plusMult, OdGeKnotVector source) : this(GlobalsPINVOKE.new_OdGeKnotVector__SWIG_6(plusMult, OdGeKnotVector.getCPtr(source)), true)
		{
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public OdGeKnotVector(OdGeKnotVector source) : this(GlobalsPINVOKE.new_OdGeKnotVector__SWIG_7(OdGeKnotVector.getCPtr(source)), true)
		{
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public OdGeKnotVector(OdGeDoubleArray source, double tol) : this(GlobalsPINVOKE.new_OdGeKnotVector__SWIG_8(OdGeDoubleArray.getCPtr(source), tol), true)
		{
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public OdGeKnotVector(OdGeDoubleArray source) : this(GlobalsPINVOKE.new_OdGeKnotVector__SWIG_9(OdGeDoubleArray.getCPtr(source)), true)
		{
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public OdGeKnotVector Assign(OdGeKnotVector knotVector)
		{
			OdGeKnotVector result = new OdGeKnotVector(GlobalsPINVOKE.OdGeKnotVector_Assign__SWIG_0(this.swigCPtr, OdGeKnotVector.getCPtr(knotVector)), false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public OdGeKnotVector Assign(OdGeDoubleArray dblArray)
		{
			OdGeKnotVector result = new OdGeKnotVector(GlobalsPINVOKE.OdGeKnotVector_Assign__SWIG_1(this.swigCPtr, OdGeDoubleArray.getCPtr(dblArray)), false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public double GetItem(int i)
		{
			double result = GlobalsPINVOKE.OdGeKnotVector_GetItem(this.swigCPtr, i);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public double startParam()
		{
			double result = GlobalsPINVOKE.OdGeKnotVector_startParam(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public double endParam()
		{
			double result = GlobalsPINVOKE.OdGeKnotVector_endParam(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public int multiplicityAt(int knotIndex)
		{
			int result = GlobalsPINVOKE.OdGeKnotVector_multiplicityAt(this.swigCPtr, knotIndex);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public int numIntervals()
		{
			int result = GlobalsPINVOKE.OdGeKnotVector_numIntervals(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public int getInterval(int order, double param, OdGeInterval interval)
		{
			int result = GlobalsPINVOKE.OdGeKnotVector_getInterval(this.swigCPtr, order, param, OdGeInterval.getCPtr(interval));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public void getDistinctKnots(OdGeDoubleArray knots, OdIntArray multiplicity)
		{
			GlobalsPINVOKE.OdGeKnotVector_getDistinctKnots__SWIG_0(this.swigCPtr, OdGeDoubleArray.getCPtr(knots), OdIntArray.getCPtr(multiplicity).Handle);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public void getDistinctKnots(OdGeDoubleArray knots)
		{
			GlobalsPINVOKE.OdGeKnotVector_getDistinctKnots__SWIG_1(this.swigCPtr, OdGeDoubleArray.getCPtr(knots));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public bool contains(double param)
		{
			bool result = GlobalsPINVOKE.OdGeKnotVector_contains(this.swigCPtr, param);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public bool isOn(double knot)
		{
			bool result = GlobalsPINVOKE.OdGeKnotVector_isOn(this.swigCPtr, knot);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public OdGeKnotVector reverse()
		{
			OdGeKnotVector result = new OdGeKnotVector(GlobalsPINVOKE.OdGeKnotVector_reverse(this.swigCPtr), false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public OdGeKnotVector removeAt(int knotIndex)
		{
			OdGeKnotVector result = new OdGeKnotVector(GlobalsPINVOKE.OdGeKnotVector_removeAt(this.swigCPtr, knotIndex), false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public OdGeKnotVector removeSubVector(int startIndex, int endIndex)
		{
			OdGeKnotVector result = new OdGeKnotVector(GlobalsPINVOKE.OdGeKnotVector_removeSubVector(this.swigCPtr, startIndex, endIndex), false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public OdGeKnotVector insertAt(int knotIndex, double knot, int multiplicity)
		{
			OdGeKnotVector result = new OdGeKnotVector(GlobalsPINVOKE.OdGeKnotVector_insertAt__SWIG_0(this.swigCPtr, knotIndex, knot, multiplicity), false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public OdGeKnotVector insertAt(int knotIndex, double knot)
		{
			OdGeKnotVector result = new OdGeKnotVector(GlobalsPINVOKE.OdGeKnotVector_insertAt__SWIG_1(this.swigCPtr, knotIndex, knot), false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public OdGeKnotVector insert(double param)
		{
			OdGeKnotVector result = new OdGeKnotVector(GlobalsPINVOKE.OdGeKnotVector_insert(this.swigCPtr, param), false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public int append(double knot)
		{
			int result = GlobalsPINVOKE.OdGeKnotVector_append__SWIG_0(this.swigCPtr, knot);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public OdGeKnotVector append(OdGeKnotVector tail, double knotRatio)
		{
			OdGeKnotVector result = new OdGeKnotVector(GlobalsPINVOKE.OdGeKnotVector_append__SWIG_1(this.swigCPtr, OdGeKnotVector.getCPtr(tail), knotRatio), false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public OdGeKnotVector append(OdGeKnotVector tail)
		{
			OdGeKnotVector result = new OdGeKnotVector(GlobalsPINVOKE.OdGeKnotVector_append__SWIG_2(this.swigCPtr, OdGeKnotVector.getCPtr(tail)), false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public int split(double param, OdGeKnotVector pKnotHead, int multLast, OdGeKnotVector pKnotTail, int multFirst)
		{
			int result = GlobalsPINVOKE.OdGeKnotVector_split(this.swigCPtr, param, OdGeKnotVector.getCPtr(pKnotHead), multLast, OdGeKnotVector.getCPtr(pKnotTail), multFirst);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public OdGeKnotVector setRange(double lower, double upper)
		{
			OdGeKnotVector result = new OdGeKnotVector(GlobalsPINVOKE.OdGeKnotVector_setRange(this.swigCPtr, lower, upper), false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public double tolerance()
		{
			double result = GlobalsPINVOKE.OdGeKnotVector_tolerance(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public OdGeKnotVector setTolerance(double tol)
		{
			OdGeKnotVector result = new OdGeKnotVector(GlobalsPINVOKE.OdGeKnotVector_setTolerance(this.swigCPtr, tol), false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public int length()
		{
			int result = GlobalsPINVOKE.OdGeKnotVector_length(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public bool isEmpty()
		{
			bool result = GlobalsPINVOKE.OdGeKnotVector_isEmpty(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public int logicalLength()
		{
			int result = GlobalsPINVOKE.OdGeKnotVector_logicalLength(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public OdGeKnotVector setLogicalLength(int size)
		{
			OdGeKnotVector result = new OdGeKnotVector(GlobalsPINVOKE.OdGeKnotVector_setLogicalLength(this.swigCPtr, size), false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public int physicalLength()
		{
			int result = GlobalsPINVOKE.OdGeKnotVector_physicalLength(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public OdGeKnotVector setPhysicalLength(int arg0)
		{
			OdGeKnotVector result = new OdGeKnotVector(GlobalsPINVOKE.OdGeKnotVector_setPhysicalLength(this.swigCPtr, arg0), false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public int growLength()
		{
			int result = GlobalsPINVOKE.OdGeKnotVector_growLength(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public OdGeKnotVector setGrowLength(int rowLength)
		{
			OdGeKnotVector result = new OdGeKnotVector(GlobalsPINVOKE.OdGeKnotVector_setGrowLength(this.swigCPtr, rowLength), false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public OdGeKnotVector set(int size, double[] source, double tol)
		{
			OdGeKnotVector result = new OdGeKnotVector(GlobalsPINVOKE.OdGeKnotVector_set__SWIG_0(this.swigCPtr, size, Helpers.MarshaldoubleFixedArray(source), tol), false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public OdGeKnotVector set(int size, double[] source)
		{
			OdGeKnotVector result = new OdGeKnotVector(GlobalsPINVOKE.OdGeKnotVector_set__SWIG_1(this.swigCPtr, size, Helpers.MarshaldoubleFixedArray(source)), false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		private object locker = new object();

		private HandleRef swigCPtr;

		protected bool swigCMemOwn;
	}
}
